﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EP.Packet
{
    /// <summary>
    /// An EP Adress is in range 0<= Adr <= 255.
    /// 0 is localhost loopback (as ip 127.0.0.1)
    /// 1 is debug host (normally a PC with a EP debug console)
    /// 255 is Broadcast
    /// </summary>
    struct EP_Adress
    {
        private int adress;
        
        public int Adress
        {
            get
            {
                return this.adress;
            }
        }

        public EP_Adress(int adr)
        {
            if (adr >= 0 && adr <= 255)
            {
                this.adress = adr;
            }
            else
            {
                throw new System.ArgumentOutOfRangeException("adr", "EP Adress must be in range 0<= adr <= 255.");
            }
        }

        public EP_Adress(byte adr)
        {
            this.adress = (int)adr;
        }
    }
}
